package 小D的abc变换问题.src.main;

public class Main {
    public static String solution(String s, int k) {
        // write code here
        for (int i = 1; i <= k; ++i) {
            s = StringOperate(s);
        }
        return s;
    }

    public static String StringOperate(String s) {
        StringBuilder result = new StringBuilder(); // Builder
        for (char c : s.toCharArray()) {
            // 根据字符 c 进行变换
            switch (c) {
                case 'a':
                    result.append("bc");
                    break;
                case 'b':
                    result.append("ca");
                    break;
                case 'c':
                    result.append("ab");
                    break;
            }
        }
        return result.toString();

    }

    public static void main(String[] args) {
        System.out.println(solution("abc", 2).equals("caababbcbcca"));
        System.out.println(solution("abca", 3).equals("abbcbccabccacaabcaababbcabbcbcca"));
        System.out.println(solution("cba", 1).equals("abcabc"));
    }
}
